import { GetServerSideProps, NextPage, PageConfig } from 'next';
import Head from 'next/head';
import { useEffect, useState } from 'react';
import { tbstudent } from '../../../atoms/db';
import Content from './content';

interface IProps {
	student: ITbstudent;
}

/**
 * 报名信息详情
 */
const Page: NextPage<IProps> = ({ student }) => {
	return (
		<>
			<Head>
				<title>报名信息详情</title>
			</Head>
			<Content student={student} />
		</>
	);
};

export const config: PageConfig = {
	amp: false
};

export default Page;
// pre-render this page on each request
export const getServerSideProps: GetServerSideProps<IProps> = async (context) => {
	const id = context.query.id as string;
	const student = await tbstudent()
		.first('*')
		.where({
			student_id: id
		});
	return {
		props: {
			student
		}
	};
};

